home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / games / nhak_src.zip / PANIC.C < prev    next >
C/C++ Source or Header  |  1993-03-16  |  937b  |  46 lines

  1. /*    SCCS Id: @(#)panic.c    3.0    89/11/15
  2.  * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
  3.  *
  4.  *    This code was adapted from the code in end.c to run in a standalone
  5.  *    mode for the makedefs / drg code.
  6.  */
  7. /* NetHack may be freely redistributed.  See license for details. */
  8.  
  9. #define NEED_VARARGS
  10. #include    "config.h"
  11.  
  12. #ifdef MSDOS
  13. #undef exit
  14. extern void FDECL(exit, (int));
  15. #endif
  16. #ifdef AZTEC
  17. #define abort() exit()
  18. #endif
  19.  
  20. /*VARARGS1*/
  21. boolean panicking;
  22.  
  23. void
  24. panic VA_DECL(char *,str)
  25.     VA_START(str);
  26.     VA_INIT(str, char *);
  27.     if(panicking++)
  28. #ifdef SYSV
  29.         (void)
  30. #endif
  31.         abort();    /* avoid loops - this should never happen*/
  32.  
  33.     (void) fputs(" ERROR:  ", stderr);
  34.     Vprintf(str,VA_ARGS);
  35.     (void) fflush(stderr);
  36. #if defined(UNIX) || defined(VMS)
  37. # ifdef SYSV
  38.         (void)
  39. # endif
  40.             abort();    /* generate core dump */
  41. #endif
  42.     VA_END();
  43.     exit(1);        /* redundant */
  44.     return;
  45. }
  46.